﻿<window:MetroDPIWindow x:Class="CircuitDiagram.winOptions"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cd="clr-namespace:CircuitDiagram"
        xmlns:window="clr-namespace:CircuitDiagram.DPIWindow;assembly=CircuitDiagram.DPIWindow"
        xmlns:my="clr-namespace:CircuitDiagram"
        Title="Options" Height="460" Width="490" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner"
        TitleCaps="False" WindowTransitionsEnabled="False" EnableDWMDropShadow="True">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <cd:NotConverter x:Key="NotConverter" />
            <my:MultiResolutionImageToImageSourceConverter x:Key="MultiResolutionImageToImageSourceConverter" />
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <TabControl Margin="12,12,12,41" Name="tbctlMain" Style="{StaticResource CDTabControl}">
            <TabItem Header="General" Name="tabGeneral">
                <Grid>
                    <StackPanel Orientation="Vertical">
                        <GroupBox Name="gbxAppearance" Header="Appearance" Margin="12,10,12,0">
                            <StackPanel>
                                <CheckBox Content="Show toolbox scroll bar" Margin="6,6,6,6" Name="chbShowToolboxScrollBar" />
                                <CheckBox Content="Show grid" Margin="6,0,6,6" Name="chbShowGrid" />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox Name="gbxDeveloper" Header="Developer" Margin="12,4,12,0">
                            <StackPanel>
                                <CheckBox Content="Show connection points"  Margin="6,6,6,6" Name="chbShowConnectionPoints" />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox Name="gbxRecentFiles" Header="Recent Files" Margin="12,4,12,0">
                            <StackPanel Orientation="Horizontal">
                                <Button Margin="6,6,6,6" Content="Clear" Height="23" Name="btnClearRecentFiles" Width="75" Click="btnClearRecentFiles_Click" />
                                <TextBlock Name="lblClearRecentFiles" Margin="6,6,6,6" Text="Clear the list of previously opened files." VerticalAlignment="Center" />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox Name="gbxOther" Header="Other" Margin="12,4,12,0">
                            <StackPanel>
                                <CheckBox Content="Check for updates automatically" Margin="6,6,6,6" Name="chbCheckForUpdatesAutomatically" />
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem Header="Implementations" Name="tabImplementations">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Height="28" Margin="5" Name="lblChooseRepresentationsHolder" VerticalAlignment="Top">
                        <TextBlock Name="lblChooseRepresentations" TextWrapping="WrapWithOverflow">Choose how standard components are represented.</TextBlock>
                    </Label>

                    <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Margin="5,0" Content="Collection" Height="28" Name="lblCollection" />
                        <ComboBox Grid.Column="2" Margin="5,3" Name="cbxImplementationsSet" IsEditable="True" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
                    </Grid>
                    
                    <ListBox Grid.Column="0" Grid.Row="2" Margin="8" Name="lbxImplementationsComponents" Width="160" ItemsSource="{Binding ElementName=cbxImplementationsSet,Path=SelectedItem.Items}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ImplementationName}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    
                    <Grid Grid.Row="2" Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="20" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Row="0" Grid.Column="0" Content="Name" Height="28" />
                        <Label Grid.Row="0" Grid.Column="2" Content="{Binding ElementName=lbxImplementationsComponents,Path=SelectedItem.ToName}" Height="28" />
                        
                        <Label Grid.Row="1" Grid.Column="0" Name="lblConfiguration" Content="Configuration" Height="28" />
                        <Label Grid.Row="1" Grid.Column="2" Content="{Binding ElementName=lbxImplementationsComponents,Path=SelectedItem.ToConfiguration}" Height="28" />
                        
                        <Label Grid.Row="2" Grid.Column="0" Name="lblIcon" Content="Icon" Height="28" />
                        <Rectangle Grid.Row="2" Grid.Column="2" Fill="White" Width="32" Height="32" HorizontalAlignment="Left">
                            <Rectangle.OpacityMask>
                                <ImageBrush ImageSource="{Binding ElementName=lbxImplementationsComponents, Path=SelectedItem.ToIcon, Converter={StaticResource MultiResolutionImageToImageSourceConverter}}" Stretch="None" />
                            </Rectangle.OpacityMask>
                        </Rectangle>
                        
                        <Label Grid.Row="3" Grid.Column="0" Content="GUID" Height="28" Name="lblGuid" />
                        <TextBox Grid.Row="3" Grid.Column="2" Text="{Binding ElementName=lbxImplementationsComponents,Path=SelectedItem.ToGUID}" Height="28" IsReadOnly="True" Background="Transparent" Style="{StaticResource SelectLabel}" />
                        
                        <Rectangle Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Height="1" Stroke="Gray" Margin="8,0" />
                        
                        <StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,0,0,5">
                            <Button Margin="8" Content="New" Height="23" Name="btnImplementationsNew" VerticalAlignment="Bottom" Width="75" Click="btnImplementationsNew_Click" />
                            <Button Margin="8" Content="Delete" Height="23" Name="btnImplementationsDelete" VerticalAlignment="Bottom" Width="75" Click="btnImplementationsDelete_Click" />
                        </StackPanel>
                    </Grid>
                </Grid>
            </TabItem>
            <TabItem Header="CDDX">
                <StackPanel>
                    <GroupBox Header="Embed" Margin="12,10,12,0" VerticalAlignment="Top">
                        <Grid>
                            <Label Content="Embed components" Height="28" HorizontalAlignment="Left" Margin="6,9,0,0" Name="label4" VerticalAlignment="Top" />
                            <ComboBox Margin="193,12,6,0" Name="cbxEmbedComponents" VerticalAlignment="Top">
                                <ComboBoxItem>All</ComboBoxItem>
                                <ComboBoxItem>Automatic</ComboBoxItem>
                                <ComboBoxItem>None</ComboBoxItem>
                            </ComboBox>
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Display" Margin="12,4,12,0" VerticalAlignment="Top">
                        <StackPanel>
                            <CheckBox Content="Show Circuit Diagram Document options when saving" Margin="6,17,99,0" Name="chbShowCDDXOptions" VerticalAlignment="Top" Width="309" />
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Header="Information" Margin="12,4,12,0">
                        <Grid>
                            <Label Content="Creator" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
                            <CheckBox Name="chbCreatorUseComputerUserName" Content="Use computer user name" HorizontalAlignment="Left" Margin="115,16,0,0" VerticalAlignment="Top"/>
                            <TextBox Name="tbxCreatorName" Height="23" Margin="138,36,10,0" TextWrapping="Wrap" VerticalAlignment="Top" IsEnabled="{Binding ElementName=chbCreatorUseComputerUserName, Path=IsChecked, Converter={StaticResource NotConverter}, Mode=OneWay}" />
                        </Grid>
                    </GroupBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Plugins">
                <Grid>
                    <Label Content="Enable or disable plugins." Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" VerticalAlignment="Top" />
                    <ListBox Margin="6,40,6,6" Name="lbxPlugins" Height="203">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding IsEnabled}" VerticalAlignment="Center" Margin="0,0,10,0" />
                                    <StackPanel Orientation="Vertical">
                                        <TextBlock Text="{Binding Name}" FontSize="12" />
                                        <TextBlock Text="{Binding Author}" FontSize="10" Foreground="Gray" />
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Version " FontSize="10" Foreground="Gray" />
                                            <TextBlock Text="{Binding Version}" FontSize="10" Foreground="Gray" />
                                        </StackPanel>
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </TabItem>
        </TabControl>
        <Button Content="Cancel" Height="23" HorizontalAlignment="Right" Margin="0,0,12,12" Name="btnCancel" VerticalAlignment="Bottom" Width="75" Click="btnCancel_Click" />
        <Button Content="OK" Height="23" HorizontalAlignment="Right" Margin="0,0,93,12" Name="btnOK" VerticalAlignment="Bottom" Width="75" Click="button2_Click" />
    </Grid>
</window:MetroDPIWindow>
